<template>
  <div class="home">
    <!-- 头部轮播轮 -->
    <van-swipe :autoplay="3000" indicator-color="white">
      <van-swipe-item v-for="item in imgList" :key="item">
        <img :src="item" alt>
      </van-swipe-item>
    </van-swipe>
    <!-- 中间导航栏 -->
    <div>
      <ul class="nav-box">
        <li class="nav-item" @click="jumpNews('newslist')">
          <i>
            <img src="../assets/images/下载 (6).png" alt>
          </i>
          <p>新闻资讯</p>
        </li>
        <li class="nav-item" @click="jumpImgs('imgslist') ">
          <i>
            <img src="../assets/images/下载 (5).png" alt>
          </i>
          <p>图片分享</p>
        </li>
        <li class="nav-item" @click="jumpDity('commoditylist')">
          <i>
            <img src="../assets/images/下载 (4).png" alt>
          </i>
          <p>商品购买</p>
        </li>
        <li class="nav-item">
          <i>
            <img src="../assets/images/下载 (3).png" alt>
          </i>
          <p>留言反馈</p>
        </li>
        <li class="nav-item">
          <i>
            <img src="../assets/images/下载 (2).png" alt>
          </i>
          <p>视频专区</p>
        </li>
        <li class="nav-item">
          <i>
            <img src="../assets/images/下载 (1).png" alt>
          </i>
          <p>联系我们</p>
        </li>
      </ul>
    </div>
    <!-- 底部标签栏 -->
    <van-tabbar v-model="active">
      <van-tabbar-item icon="home-o">首页</van-tabbar-item>
      <van-tabbar-item icon="gem">会员</van-tabbar-item>
      <van-tabbar-item icon="cart">购物车</van-tabbar-item>
      <van-tabbar-item icon="search">搜索</van-tabbar-item>
    </van-tabbar>
  </div>
</template>

<script>
export default {
  data () {
    return {
      imgList: [
        'http://m.itcast.cn/images/newslide/homepageandphone/20181528141522828.jpg',
        'http://m.itcast.cn/images/newslide/homepageandphone/20180918170957294.jpg',
        'http://m.itcast.cn/images/newslide/homepageandphone/20184827134845878.jpg'
      ],
      active: 0
    }
  },
  methods: {
    jumpNews (routerName) {
      this.$router.push({ name: routerName })
    },
    jumpImgs (routerName) {
      this.$router.push({ name: routerName })
    },
    jumpDity (routerName) {
      this.$router.push({ name: routerName })
    }
  }
}
</script>
<style lang="scss" scoped>
  .home {
    .van-swipe {
      height: 205px;
      img {
        height: 100%;
        width: 100%;
      }
    }
    .nav-box {
      display: flex;
      flex-wrap: wrap;
      width: 100%;
      height: 100%;
      .nav-item {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        width: 33.33%;
        margin: 10px 0;
        cursor: pointer;
        p {
          font-size: 20px;
        }
        img {
          width: 60px;
          height: 60px;
        }
      }
    }
  }
</style>
